import request from '@/utils/request.js'



export function taskList (data){
    let urlParam = objToUrlParam(data);
    if(urlParam != null && urlParam != '') {
        urlParam = '?' + urlParam;
    }

    return request({
        url:'/task/taskList' + urlParam,
        method: 'get'
    })
}


function objToUrlParam(data) {
    if (!data) return '';

    return Object.keys(data)
        .filter(key => data[key] !== null && data[key] !== undefined && data[key] !== '')
        .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
        .join('&');
}